package com.dianping.cat.consumer.transaction.model.transform;
import com.dianping.cat.consumer.transaction.model.entity.AllDuration;
import com.dianping.cat.consumer.transaction.model.entity.Duration;
import com.dianping.cat.consumer.transaction.model.entity.Graph;
import com.dianping.cat.consumer.transaction.model.entity.Graph2;
import com.dianping.cat.consumer.transaction.model.entity.GraphTrend;
import com.dianping.cat.consumer.transaction.model.entity.Machine;
import com.dianping.cat.consumer.transaction.model.entity.Range;
import com.dianping.cat.consumer.transaction.model.entity.Range2;
import com.dianping.cat.consumer.transaction.model.entity.StatusCode;
import com.dianping.cat.consumer.transaction.model.entity.TransactionName;
import com.dianping.cat.consumer.transaction.model.entity.TransactionReport;
import com.dianping.cat.consumer.transaction.model.entity.TransactionType;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/*  21 */     this.m_deferedJobs = new ArrayList();


    this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/*  28 */     for (Runnable job : this.m_deferedJobs) {
      job.run();
    }
  }


  public boolean onAllDuration(final TransactionType parent, final AllDuration allDuration) {
/*  35 */     if (this.m_deferrable) {
      this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  39 */               parent.addAllDuration(allDuration);
            }
          });
    } else {
/*  43 */       parent.addAllDuration(allDuration);
    }

/*  46 */     return true;
  }


  public boolean onAllDuration(final TransactionName parent, final AllDuration allDuration) {
/*  51 */     if (this.m_deferrable) {
/*  52 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  55 */               parent.addAllDuration(allDuration);
            }
          });
    } else {
/*  59 */       parent.addAllDuration(allDuration);
    }

/*  62 */     return true;
  }


  public boolean onAllDuration(final Range parent, final AllDuration allDuration) {
/*  67 */     if (this.m_deferrable) {
/*  68 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  71 */               parent.addAllDuration(allDuration);
            }
          });
    } else {
/*  75 */       parent.addAllDuration(allDuration);
    }

    return true;
  }


  public boolean onAllDuration(final Range2 parent, final AllDuration allDuration) {
/*  83 */     if (this.m_deferrable) {
/*  84 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/*  87 */               parent.addAllDuration(allDuration);
            }
          });
    } else {
/*  91 */       parent.addAllDuration(allDuration);
    }

/*  94 */     return true;
  }


  public boolean onDuration(final TransactionName parent, final Duration duration) {
/*  99 */     if (this.m_deferrable) {
/* 100 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 103 */               parent.addDuration(duration);
            }
          });
    } else {
/* 107 */       parent.addDuration(duration);
    }

/* 110 */     return true;
  }


  public boolean onGraph(final TransactionName parent, final Graph graph) {
/* 115 */     if (this.m_deferrable) {
/* 116 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 119 */               parent.addGraph(graph);
            }
          });
    } else {
/* 123 */       parent.addGraph(graph);
    }

/* 126 */     return true;
  }


  public boolean onGraph2(final TransactionType parent, final Graph2 graph2) {
/* 131 */     if (this.m_deferrable) {
/* 132 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 135 */               parent.addGraph2(graph2);
            }
          });
    } else {
/* 139 */       parent.addGraph2(graph2);
    }

/* 142 */     return true;
  }


  public boolean onGraphTrend(TransactionType parent, GraphTrend graphTrend) {
/* 147 */     parent.setGraphTrend(graphTrend);
/* 148 */     return true;
  }


  public boolean onGraphTrend(TransactionName parent, GraphTrend graphTrend) {
/* 153 */     parent.setGraphTrend(graphTrend);
/* 154 */     return true;
  }


  public boolean onMachine(final TransactionReport parent, final Machine machine) {
/* 159 */     if (this.m_deferrable) {
/* 160 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 163 */               parent.addMachine(machine);
            }
          });
    } else {
/* 167 */       parent.addMachine(machine);
    }

/* 170 */     return true;
  }


  public boolean onName(final TransactionType parent, final TransactionName name) {
/* 175 */     if (this.m_deferrable) {
/* 176 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 179 */               parent.addName(name);
            }
          });
    } else {
/* 183 */       parent.addName(name);
    }

/* 186 */     return true;
  }


  public boolean onRange(final TransactionName parent, final Range range) {
/* 191 */     if (this.m_deferrable) {
/* 192 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 195 */               parent.addRange(range);
            }
          });
    } else {
/* 199 */       parent.addRange(range);
    }

/* 202 */     return true;
  }


  public boolean onRange2(final TransactionType parent, final Range2 range2) {
/* 207 */     if (this.m_deferrable) {
/* 208 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 211 */               parent.addRange2(range2);
            }
          });
    } else {
/* 215 */       parent.addRange2(range2);
    }

/* 218 */     return true;
  }


  public boolean onStatusCode(final TransactionName parent, final StatusCode statusCode) {
/* 223 */     if (this.m_deferrable) {
/* 224 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 227 */               parent.addStatusCode(statusCode);
            }
          });
    } else {
/* 231 */       parent.addStatusCode(statusCode);
    }

/* 234 */     return true;
  }


  public boolean onType(final Machine parent, final TransactionType type) {
/* 239 */     if (this.m_deferrable) {
/* 240 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 243 */               parent.addType(type);
            }
          });
    } else {
/* 247 */       parent.addType(type);
    }

/* 250 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/transaction/model/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */